﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace CP.Utility.Extenisions
{
    public static class IListExtension
    {
        public static IList<T> ToIList<T>(this IList list) where T : class
        {
            if ((null == list) || (list.Count == 0)) return null;
            IList<T> listT = new List<T>();
            foreach (object obj in list)
            {
                T item = obj as T;
                if (null == item) continue;
                listT.Add(item);
            }
            if (listT.Count == 0) return null;
            return listT;
        }
    }
}
